StringToUpper Function

public function StringToUpper(string) result(new)

Return a string that has all letters in upper case Arguments: string String to be treated Result: String with letters turned into upper case

Arguments

Type IntentOptional Attributes Name
character(len=*) :: string

Return Value character(len=LEN)


Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i
integer(kind=short), public :: k
integer(kind=short), public :: length

Source Code

FUNCTION StringToUpper &
  ( string )           &
RESULT (new)

IMPLICIT NONE

! Function arguments
! Scalar arguments with intent(in):
CHARACTER(LEN=*)   :: string

! Local scalars:
CHARACTER(LEN=LEN(string)) :: new
INTEGER (KIND = short)     :: k 
INTEGER (KIND = short)     :: i
INTEGER (KIND = short)     :: length
!------------end of declaration------------------------------------------------

length = LEN(string)
new    = string
DO i = 1,length
   k = INDEX( lower, string(i:i) )
   IF ( k > 0 ) THEN
       new(i:i) = upper(k:k)
   END IF
END DO
END FUNCTION StringToUpper